package com.kgis.fm.business.model;

import java.util.HashMap;
import java.util.Map;

import com.kgis.kp.common.util.Detect;

public class ExtensionAttributes extends HashMap<String, Object> {

	private static final long serialVersionUID = -3828439449242616418L;

	public ExtensionAttributes() {
		super();
	}

	public void addAttribute(Map<String, Object> attributes) {
		if (null != attributes)
			super.putAll(attributes);
	}

	public void addAttribute(String key, Object value) {
		if (null != key)
			super.put(key, value);
	}

	public Object put(String key, Object value) {
		if (null != value) {
			if (value instanceof String[]) {
				String[] stringValues = (String[]) value;
				if (Detect.notEmpty(stringValues)) {
					value = stringValues[0];
				}
			}
		}
		return super.put(key, value);
	}

}
